<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="gwm" uri="http://www.gwm.cn" %>
<!DOCTYPE>
<!--防止倒链标签-->
<gwm:referer></gwm:referer>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>亚马逊 - 购物车</title>
<link href="${pageContext.request.contextPath}/css/index.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath}/css/adv.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath}/css/style.css" rel="stylesheet" type="text/css" />
<script src="${pageContext.request.contextPath}/scripts/jquery-2.1.0.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/scripts/adv.js" type="text/javascript"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/scripts/function.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/scripts/index.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/scripts/function-manage.js"></script>
<script type="text/javascript" src="scripts/shopping.js"></script>
</head>
<body>
<%@ include file="index_top.jsp"  %>

<div id="position" class="wrap">
	您现在的位置：<a href="index.jsp">亚马逊</a> &gt; 购物车<span style="float:right;color:red;">
</div>
<div class="wrap">
	<div id="shopping">
		<form action="${pageContext.request.contextPath }/OrderServlet" method="post">
			<table>
				<tr>
					<th>商品名称</th>
					<th>商品价格</th>
					<th>购买数量</th>
					<th>操作</th>
				</tr>
				
				<!-- 根据用户购物车生成列表 -->
				<c:forEach items="${sessionScope.shoppingList }" var="shopping">
				<tr id="product_id_1">
					<td class="thumb"><img style="width: 100px; height: 100px;" src="${shopping.product.hp_file_name }" /><a href="${pageContext.request.contextPath }/PviewServlet?pId=${shopping.pid }">${shopping.product.hp_name}</a></td>
					<td class="price" id="price_id_1">
						￥<span id="span_1">${shopping.product.hp_price }</span>
						<input type="hidden" id="subPrice" value="${shopping.product.hp_price*shopping.quantity }" name="sumPrice"/>
						<input type="hidden"  value="${shopping.pid }" name="pId"/>
						<input type="hidden"  value="${shopping.product.hp_stock }" name="hpStock" id="hpStock${shopping.pid }"/>
					</td>
					<td class="number">
							<%-- <c:set var="hcid" value="${shopping.pid }"></c:set> --%>
							<input type="button" id="minus" value=" - " width="3px" onclick=" reduce(${shopping.pid  })" name="minusButton">
							<input id="${shopping.pid  }" type="text" name="number" value="${shopping.quantity }" maxlength="5"
							size="1"  style="text-align:center; vertical-align:middle"  onfocus="checkStockFocus(${shopping.pid})" onblur="checkStock(${shopping.pid  })"/>
							<input type="button" id="add" value=" + " width="2px" onclick=" increase(${shopping.pid  })" name="addButton">		
					</td>
					<%-- ${pageContext.request.contextPath}/CartOperServlet?type=delete&pid=${shopping.pid  } --%>
					<td class="delete"><a href="javascript:void(0)" onclick="return Delete(${shopping.pid})">删除</a></td>
				</tr>
				</c:forEach>
			</table>
			<div class="button"><input onclick="buttonTest(${sessionScope.shoppingList.size()})" type="submit" value="" /></div>
		</form>
	</div>
</div>
<div id="footer">
	Copyright &copy; 2016 上海海文 All Rights Reserved.
</div>
</body>
</html>

